import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 求一个整数，在内存当中存储时，二进制1的个数。
 * User: 15085202591
 * Date: 2022-10-31
 * Time: 11:02
 */
public class CountOne {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入一个整数：");
        int input = sc.nextInt();
        int n=input;
        int count = 0;
        while(input != 0){
            if((input & 1) ==1){
                count++;
            }
            input>>>=1;
        }
        System.out.println(n + "二进制数中有" + count + "个1");
    }
}
